package com.googlecode.gwtbb.client.only.widget.display.forum;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.googlecode.gwtbb.client.only.GwtbbCmess;
import com.googlecode.gwtbb.client.only.widget.basic.Spacer;
import com.googlecode.gwtbb.client.shared.entity.forum.Post;

/**
 * @author Abraham Grief
 * @version $Id$
 * @since May 6, 2008
 */
public class PostSummaryWithSubject extends Composite {
	public PostSummaryWithSubject(Post post) {
		VerticalPanel mainPanel = new VerticalPanel();
		initWidget(mainPanel);
		mainPanel.setStylePrimaryName("gwtbb-small");
		Post.Info postInfo = post.getInfo();
		if (postInfo != null) {
			HorizontalPanel row = new HorizontalPanel();
			row.add(new Label(GwtbbCmess.instance().inLabel()));
			row.add(new Spacer());
			row.add(new Label(postInfo.getThread().getSubject()));
			mainPanel.add(row);
		}
		mainPanel.add(new PostSummary(post));
	}
}